package com.zx._10_设计模式.行为型模式.责任链模式.demo2;

import java.util.concurrent.TimeUnit;

/**
 * 责任链--链表实现方式
 *
 * @date: 2019年6月18日上午10:26:51
 */
public class Main {

    public static void main(String[] args) {
        // 列表结构责任链
        ChianHandlerLinkedProcess process = new ChianHandlerLinkedProcess();
        boolean process2 = process.process();
        System.out.println(process2);

        // 链表结构责任链
        ChianHandlerListProcess pro = new ChianHandlerListProcess();
        boolean pro2 = pro.process();
        System.out.println(pro2);

        long n1 = System.nanoTime();

        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        long n2 = System.nanoTime();

        // 纳秒
        long nanoseconds = (n2 - n1);
        System.out.println(nanoseconds);

        // 微秒
        long microseconds = (n2 - n1) / 1000;
        System.out.println(microseconds);

        // 毫秒
        long milliseconds = (n2 - n1) / 1000_000;
        System.out.println(milliseconds);

        // 秒
        long seconds = (n2 - n1) / 1000_000_000;
        System.out.println(seconds);
    }

}
